package com.campus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campus.entity.PostViews;
import org.apache.ibatis.annotations.Param;

public interface PostViewsMapper extends BaseMapper<PostViews> {
    /**
     * 插入浏览记录
     * @param postViews
     * @return
     */
    int insertPostView(PostViews postViews);
    
    /**
     * 统计帖子浏览量
     * @param postId
     * @return
     */
    Integer getViewCountByPostId(@Param("postId") String postId);
    
    /**
     * 检查用户是否已浏览过该帖子
     * @param postId
     * @param userId
     * @return
     */
    int checkViewExists(@Param("postId") String postId, @Param("userId") String userId);
}